package server.dao;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import server.model.entity.Shop;
import server.model.entity.UserDeposit;

import java.util.List;

/**
 * 创建人:    xvzhe
 * 创建时间:
 * 修改时间:
 * 版本:      v1.0
 */
public interface UserDepositDao extends JpaRepository<UserDeposit, String> {
    List<UserDeposit> findByUserIdAndStatus(String userId,Boolean status);

    UserDeposit findByUserIdAndIsDefaultAndStatus(String userId, Boolean isDefault,Boolean status);

    @Modifying
    @Query(value = "update user_deposit set is_Default = 0 where user_id = ?1", nativeQuery = true)
    Integer updateDefaByUserId(String userId);
}
